package ch1.base;

/**
 * 比较start()和run()的区别
 */
public class CompareStartAndRun {
    private static class TestThread extends Thread {
        @Override
        public void run() {
            int i = 90;
            while (i > 0) {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("I am " + Thread.currentThread().getName() + " and the i is " + i--);
            }
        }
    }

    public static void main(String[] args) {
        TestThread testThread = new TestThread();
        testThread.run();     //调用者是main
//        testThread.start();     //调用者是线程名称
    }
}